3.430 \(\int \frac{a+a \sin (e+f x)}{c+d \sin (e+f x)} \, dx\)

Optimal. Leaf size=63 \[ \frac{a x}{d}-\frac{2 a (c-d) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{d f \sqrt{c^2-d^2}} \]

[Out]

(a*x)/d - (2*a*(c - d)*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/(d*Sqrt[c^2 - d^2]*f)

________________________________________________________________________________________

Rubi [A]  time = 0.0911328, antiderivative size = 63, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.174, Rules used = {2735, 2660, 618, 204} \[ \frac{a x}{d}-\frac{2 a (c-d) \tan ^{-1}\left (\frac{c \tan \left (\frac{1}{2} (e+f x)\right )+d}{\sqrt{c^2-d^2}}\right )}{d f \sqrt{c^2-d^2}} \]

Antiderivative was successfully verified.

[In]

Int[(a + a*Sin[e + f*x])/(c + d*Sin[e + f*x]),x]

[Out]

(a*x)/d - (2*a*(c - d)*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/(d*Sqrt[c^2 - d^2]*f)

Rule 2735

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*x)/d
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 2660

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x]}, Dis
t[(2*e)/d, Subst[Int[1/(a + 2*b*e*x + a*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] &&
 NeQ[a^2 - b^2, 0]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{a+a \sin (e+f x)}{c+d \sin (e+f x)} \, dx &=\frac{a x}{d}-\frac{(a (c-d)) \int \frac{1}{c+d \sin (e+f x)} \, dx}{d}\\ &=\frac{a x}{d}-\frac{(2 a (c-d)) \operatorname{Subst}\left (\int \frac{1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac{1}{2} (e+f x)\right )\right )}{d f}\\ &=\frac{a x}{d}+\frac{(4 a (c-d)) \operatorname{Subst}\left (\int \frac{1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac{1}{2} (e+f x)\right )\right )}{d f}\\ &=\frac{a x}{d}-\frac{2 a (c-d) \tan ^{-1}\left (\frac{d+c \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c^2-d^2}}\right )}{d \sqrt{c^2-d^2} f}\\ \end{align*}

Mathematica [C]  time = 0.321298, size = 182, normalized size = 2.89 \[ \frac{a (\sin (e+f x)+1) \left (f x \sqrt{c^2-d^2} \sqrt{(\cos (e)-i \sin (e))^2}-2 (c-d) (\cos (e)-i \sin (e)) \tan ^{-1}\left (\frac{(\cos (e)-i \sin (e)) \sec \left (\frac{f x}{2}\right ) \left (c \sin \left (\frac{f x}{2}\right )+d \cos \left (e+\frac{f x}{2}\right )\right )}{\sqrt{c^2-d^2} \sqrt{(\cos (e)-i \sin (e))^2}}\right )\right )}{d f \sqrt{c^2-d^2} \sqrt{(\cos (e)-i \sin (e))^2} \left (\sin \left (\frac{1}{2} (e+f x)\right )+\cos \left (\frac{1}{2} (e+f x)\right )\right )^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + a*Sin[e + f*x])/(c + d*Sin[e + f*x]),x]

[Out]

(a*(-2*(c - d)*ArcTan[(Sec[(f*x)/2]*(Cos[e] - I*Sin[e])*(d*Cos[e + (f*x)/2] + c*Sin[(f*x)/2]))/(Sqrt[c^2 - d^2
]*Sqrt[(Cos[e] - I*Sin[e])^2])]*(Cos[e] - I*Sin[e]) + Sqrt[c^2 - d^2]*f*x*Sqrt[(Cos[e] - I*Sin[e])^2])*(1 + Si
n[e + f*x]))/(d*Sqrt[c^2 - d^2]*f*Sqrt[(Cos[e] - I*Sin[e])^2]*(Cos[(e + f*x)/2] + Sin[(e + f*x)/2])^2)

________________________________________________________________________________________

Maple [B]  time = 0.083, size = 119, normalized size = 1.9 \begin{align*} -2\,{\frac{ca}{df\sqrt{{c}^{2}-{d}^{2}}}\arctan \left ( 1/2\,{\frac{2\,c\tan \left ( 1/2\,fx+e/2 \right ) +2\,d}{\sqrt{{c}^{2}-{d}^{2}}}} \right ) }+2\,{\frac{a}{f\sqrt{{c}^{2}-{d}^{2}}}\arctan \left ( 1/2\,{\frac{2\,c\tan \left ( 1/2\,fx+e/2 \right ) +2\,d}{\sqrt{{c}^{2}-{d}^{2}}}} \right ) }+2\,{\frac{a\arctan \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) }{df}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+a*sin(f*x+e))/(c+d*sin(f*x+e)),x)

[Out]

-2/f*a/d/(c^2-d^2)^(1/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2))*c+2/f*a/(c^2-d^2)^(1/2)*arct
an(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2))+2/f*a/d*arctan(tan(1/2*f*x+1/2*e))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sin(f*x+e))/(c+d*sin(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.18265, size = 520, normalized size = 8.25 \begin{align*} \left [\frac{2 \, a f x + a \sqrt{-\frac{c - d}{c + d}} \log \left (\frac{{\left (2 \, c^{2} - d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2} + 2 \,{\left ({\left (c^{2} + c d\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right ) +{\left (c d + d^{2}\right )} \cos \left (f x + e\right )\right )} \sqrt{-\frac{c - d}{c + d}}}{d^{2} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2}}\right )}{2 \, d f}, \frac{a f x + a \sqrt{\frac{c - d}{c + d}} \arctan \left (-\frac{{\left (c \sin \left (f x + e\right ) + d\right )} \sqrt{\frac{c - d}{c + d}}}{{\left (c - d\right )} \cos \left (f x + e\right )}\right )}{d f}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sin(f*x+e))/(c+d*sin(f*x+e)),x, algorithm="fricas")

[Out]

[1/2*(2*a*f*x + a*sqrt(-(c - d)/(c + d))*log(((2*c^2 - d^2)*cos(f*x + e)^2 - 2*c*d*sin(f*x + e) - c^2 - d^2 +
2*((c^2 + c*d)*cos(f*x + e)*sin(f*x + e) + (c*d + d^2)*cos(f*x + e))*sqrt(-(c - d)/(c + d)))/(d^2*cos(f*x + e)
^2 - 2*c*d*sin(f*x + e) - c^2 - d^2)))/(d*f), (a*f*x + a*sqrt((c - d)/(c + d))*arctan(-(c*sin(f*x + e) + d)*sq
rt((c - d)/(c + d))/((c - d)*cos(f*x + e))))/(d*f)]

________________________________________________________________________________________

Sympy [A]  time = 162.134, size = 269, normalized size = 4.27 \begin{align*} \begin{cases} \frac{\tilde{\infty } x \left (a \sin{\left (e \right )} + a\right )}{\sin{\left (e \right )}} & \text{for}\: c = 0 \wedge d = 0 \wedge f = 0 \\\frac{a f x \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )}}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} - d f} - \frac{a f x}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} - d f} + \frac{4 a}{d f \tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} - d f} & \text{for}\: c = - d \\\frac{a x - \frac{a \cos{\left (e + f x \right )}}{f}}{c} & \text{for}\: d = 0 \\\frac{x \left (a \sin{\left (e \right )} + a\right )}{c + d \sin{\left (e \right )}} & \text{for}\: f = 0 \\\frac{a x + \frac{a \log{\left (\tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} \right )}}{f}}{d} & \text{for}\: c = 0 \\\frac{a c f x}{c d f + d^{2} f} + \frac{a d f x}{c d f + d^{2} f} + \frac{a \sqrt{- c^{2} + d^{2}} \log{\left (\tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} + \frac{d}{c} - \frac{\sqrt{- c^{2} + d^{2}}}{c} \right )}}{c d f + d^{2} f} - \frac{a \sqrt{- c^{2} + d^{2}} \log{\left (\tan{\left (\frac{e}{2} + \frac{f x}{2} \right )} + \frac{d}{c} + \frac{\sqrt{- c^{2} + d^{2}}}{c} \right )}}{c d f + d^{2} f} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sin(f*x+e))/(c+d*sin(f*x+e)),x)

[Out]

Piecewise((zoo*x*(a*sin(e) + a)/sin(e), Eq(c, 0) & Eq(d, 0) & Eq(f, 0)), (a*f*x*tan(e/2 + f*x/2)/(d*f*tan(e/2
+ f*x/2) - d*f) - a*f*x/(d*f*tan(e/2 + f*x/2) - d*f) + 4*a/(d*f*tan(e/2 + f*x/2) - d*f), Eq(c, -d)), ((a*x - a
*cos(e + f*x)/f)/c, Eq(d, 0)), (x*(a*sin(e) + a)/(c + d*sin(e)), Eq(f, 0)), ((a*x + a*log(tan(e/2 + f*x/2))/f)
/d, Eq(c, 0)), (a*c*f*x/(c*d*f + d**2*f) + a*d*f*x/(c*d*f + d**2*f) + a*sqrt(-c**2 + d**2)*log(tan(e/2 + f*x/2
) + d/c - sqrt(-c**2 + d**2)/c)/(c*d*f + d**2*f) - a*sqrt(-c**2 + d**2)*log(tan(e/2 + f*x/2) + d/c + sqrt(-c**
2 + d**2)/c)/(c*d*f + d**2*f), True))

________________________________________________________________________________________

Giac [A]  time = 1.32485, size = 116, normalized size = 1.84 \begin{align*} \frac{\frac{{\left (f x + e\right )} a}{d} - \frac{2 \,{\left (\pi \left \lfloor \frac{f x + e}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (c\right ) + \arctan \left (\frac{c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + d}{\sqrt{c^{2} - d^{2}}}\right )\right )}{\left (a c - a d\right )}}{\sqrt{c^{2} - d^{2}} d}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sin(f*x+e))/(c+d*sin(f*x+e)),x, algorithm="giac")

[Out]

((f*x + e)*a/d - 2*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(c) + arctan((c*tan(1/2*f*x + 1/2*e) + d)/sqrt(c^2 - d
^2)))*(a*c - a*d)/(sqrt(c^2 - d^2)*d))/f